home *** CD-ROM | disk | FTP | other *** search
/ Best Tools for JAVA / Best Tools for JAVA.iso / CONVERTR / LWTOIV / LWTOIV / README.TXT < prev   
Encoding:
Text File  |  1995-07-26  |  6.1 KB  |  130 lines

  1. A Lightwave to Open Inventor 3D object converter
  2. ------------------------------------------------
  3.  
  4. This directory contains a fairly simplistic 3D object conversion program to
  5. convert from the Lightwave 3D object file format into Open Inventor 2.0 files.
  6. It was developed on an SGI, and the source will only compile on a machine with
  7. C++ and the Open Inventor developer's option installed.  For those people
  8. without C++ or the Open Inventor developer's option, I have included an
  9. executable that should run on any SGI machine running IRIX 5.3 that supports
  10. OpenGL and Open Inventor.
  11.  
  12.  
  13. USAGE
  14.  
  15. The Lightwave object file name is read from the command line, and the
  16. Open Inventor file is output to stdout.
  17.  
  18. So to create an ascii Open Inventor object from an existing Lightwave file,
  19. just type something like:
  20.  
  21.     lwtoiv  lightwave_file  >inventor_file
  22.  
  23. I created this converter so I could use my SGI at work to preview many of
  24. the lightwave objects I download from various ftp sites on the internet.  So
  25. to quickly preview a Lightwave object, try this:
  26.  
  27.     lwtoiv  lightwave_file  |  ivview
  28. or
  29.     lwtoiv  lightwave_file  |  /usr/demos/Inventor/gview
  30.  
  31. Both of these commands will pipe the output to an Open Inventor viewer that
  32. will allow you to translate, rotate, or zoom in and out of the object.  The
  33. second command will also show you the hierarchical node structure of the
  34. resulting Open Inventor object, and allow you to edit some parts of the
  35. structure or individual fields in each node of the structure.
  36.  
  37.  
  38. LIMITATIONS / PROBLEMS / BUGS
  39.  
  40. As I mentioned earlier, this is just a simplistic converter used mainly for
  41. previewing Lightwave objects before I take them home to my trusty old Amiga.
  42. For that reason, many features found in a Lightwave file are ignored or are 
  43. just not converted correctly into Open Inventor format.  Here is a list of
  44. most of the limitations of this converter.
  45.  
  46.   All textures and reflection maps are ignored.  Maybe someday I'll add the
  47.   ability to handle reflection maps and color textures.
  48.  
  49.   The shading model used by Lightwave is slightly different than that used
  50.   by Inventor.  The converter uses some of my own guesses as to how to 
  51.   convert between the color, diffuse, specular, glossiness, luminance, and
  52.   transparency parameters of Lightwave to the diffuse, ambient, specular,
  53.   emissive, shininess, and transparency parameters of Inventor.
  54.  
  55.   For some objects, the default smoothing angle of Lightwave (89.5 degrees
  56.   which is 1.56207 radians) causes objects to look strange (too smoothed??)
  57.   when used as Inventor's crease angle.  You can often change the crease
  58.   angle in the Inventor nodes to improve the appearance of smoothed objects.
  59.   The program gview (mentioned above in the USAGE section) is an excellent
  60.   tool for experimenting with different crease angles (look for the
  61.   creaseAngle field in the ShapeHints node).  Remember, the crease angle
  62.   in Inventor should be specified in radians.
  63.  
  64.   Inventor does not handle the wide variety of polygon shapes allowed by
  65.   Lightwave.  By default, OpenGL (the software interface upon which the Open
  66.   Inventor toolkit is based) assumes polygons must be convex.  OpenGL does
  67.   provide some utility routines that Open Inventor uses to try and tesselate
  68.   concave poygons into groups of convex poygons, but these tesselation
  69.   routines still can not cope with all the polygon shapes allowed in Lightwave.
  70.   Here is a brief rundown on how I handle (or ignore) these problems:
  71.  
  72.      a) I test for repeated vertices in a polygon, and if found, create a
  73.     polyline node instead of a polygon and output a message to stderr that
  74.         informs the user as to which surface(s) contains polylines. I output
  75.     this message so that it is easy for an experienced Inventor user to
  76.     search for the polyline occurences in the Inventor file, and then
  77.     edit the file by hand to try and rectify this situation (for most
  78.     occurences of this problem I have only had to exert a small amount
  79.     of manual effort to convert the SoIndexedLineSet node back into the
  80.     appropriate SoIndexedFaceSet node).  The following diagram depicts 
  81.     a common situation in Lightwave objects in which this occurs (a
  82.     polygon with a hole):
  83.  
  84.         *---------------------*
  85.         |                    /|
  86.         |                   / |
  87.         |                  /  |
  88.         |    *------------*   |
  89.         |    |            |   |
  90.         |    |            |   |
  91.                 |    |            |   |
  92.                 |    *------------*   |
  93.                 |                     |
  94.                 |                     |
  95.                 *---------------------*
  96.  
  97.  
  98.      b) The other situation that Inventor does not like is when a vertex lies
  99.     on an existing edge of the polygon (self-intersecting polygon).  I do
  100.     nothing to test for this situation, and Inventor outputs its own error
  101.     message, then does not create the polygon.  Here are 2 diagrams of
  102.     polygons in which I have seen this problem:
  103.  
  104.  
  105.         *-------*-------*        *         *
  106.         |               |        |\       /|
  107.         |               |        | \     / |
  108.         |               |        |  \   /  |
  109.         |               |        |   \ /   |
  110.         *---------------*        *----*----*
  111.  
  112.     These problems could be solved by an experienced Inventor user in the
  113.     same way as problem a), but it was not as simple for me to test for 
  114.     this problem. Since I do not test for this situation, Inventor finds
  115.     the problem and just skips over the offending polygon altogether, no
  116.     polyline node is created to help rectify the situation.  The offending
  117.     polygon still exists in the Inventor file, so if it can be found it
  118.     can be corrected (its just not as easy to find the offending polygon
  119.     as it is when it is seperated into its own polyline node).
  120.  
  121. Well, that's the major problems with this converter, I'm sure there are others
  122. I don't know about or just forgot to mention here.  If you find other problems
  123. or just have any suggestions about the converter, please feel free to contact
  124. me.  I am always glad to hear any suggestions or criticisms, just realize that
  125. I may not have the time or the inclination to do anything else to this code,
  126. since it does the majority of the things I created it for.
  127.  
  128. Marvin Landis
  129. marvinl@amber.rc.arizona.edu
  130.